package controller;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

import model.MyEllipse;
import model.MyPosition;
import model.MyRectangle;
import model.MyShape;
import model.TypeImage;
import view.interfaces.IAddShapeOne;

public class ControllerAddShapeOne implements ActionListener {

	private IAddShapeOne view;

    public ControllerAddShapeOne() { }

    public void setView(IAddShapeOne viewEntry) {
            
        this.view = viewEntry;
        
    }

    public IAddShapeOne getView() {
            
        return view;
            
    }

	@Override
	public void actionPerformed(ActionEvent e) {

		String action = e.getActionCommand();

    	if(action.startsWith("SENDADDSHAPEONE")) {

			int depth = 0;
			int posX = 50;
			int posY = 50;
			int width = 250;
			int height = 500;
			Color filling = view.getValueComboBoxColorFilling();
			Color outline = view.getValueComboBoxColorOutline();
			int border = 25;
			Boolean ironWire = false;
			MyShape forme = null;

			forme = new MyRectangle(depth, 
						new MyPosition(posX, posY), 
						width, 
						height,
	    				new TypeImage<Color>(filling, outline),
						border, ironWire);

    		ControllerHome.image.addShape(forme);

    		view.hideWindowAddShape();
    		
    		System.out.println("1");

    	}
    	
	}

	
}
